#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

struct TreeNode {
    int val;
    struct TreeNode* left;
    struct TreeNode* right;
    
};

void _invertTree(struct TreeNode* root)
{
    if (root == NULL)
        return;
    _invertTree(root->left);
    _invertTree(root->right);
    struct TreeNode* tmp = root->left;
    root->left = root->right;
    root->right = tmp;
}
struct TreeNode* invertTree(struct TreeNode* root) {
    _invertTree(root);
    return root;
}